// mixins/collect.js
export default {
  methods: {
    //收藏 取消
    collect(type, data) {
      sa.ajax('/collections/' + type, {
        resourceId: data.id,
        resourceName: data.name
      }, function (res) {
        if (res.code === 200) {
          data.collectFlag = res.data
        }
      }.bind(this), {
        type: 'get'
      });
    }
  }
}